<div class="content">
	<?=n_mod('skin')->pageHead('站点配置', array()) ?>
	<div class="n-row n-margin-default-top n-margin-default-bottom">
		<form method="post" action="<?=n_url('nconfig', 'siteSave')?>">
		<div class="a-form">
			<label class="n-col-3 n-nopadding-left">配置名称</label>
			<div class="n-col-6 n-nopadding">
				<input type="text" name="title"
				value="<?=isset($data['info']) ? $data['info']['title'] : ''?>" />
			</div>
			<div class="n-col-3"></div>
		</div>
		<?php
		if (! empty($data['items'])) :
			$infodata = json_decode($data['info']['data'], true);
			foreach ($data['items'] as $key => $val) :
				if (isset($infodata[$val['ukey']])) :
					$val['default'] = $infodata[$val['ukey']];
				endif;
		?>
		<div class="a-form">
			<label class="n-col-3 n-nopadding-left"><?=$val['name']?></label>
			<div class="n-col-6 n-nopadding">
				<?php
				switch ($val['itype']) :
					case 0:
					case 2:
				?>
				<input type="text" name="itemid<?=$val['id']?>" value="<?=$val['default']?>" />
				<?php
						break;
					case 1:
				?>
				<input type="radio" name="itemid<?=$val['id']?>"
				value="1" <?=1 == $val['default'] ? 'checked' : ''?> />是
				<input type="radio" name="itemid<?=$val['id']?>"
				value="0" <?=0 == $val['default'] ? 'checked' : ''?> />否
				<?php
						break;
					case 10:
						$option = explode(',', $val['option']);
						foreach ($option as $key1 => $val1) :
				?>
				<input type="radio" name="itemid<?=$val['id']?>"
				value="<?=$val1?>" <?=$val1 == $val['default'] ? 'checked' : ''?> /><?=$val1?>
				<?php
						endforeach;
						break;
					case 11:
						$option = explode(',', $val['option']);
						foreach ($option as $key1 => $val1) :
				?>
				<input type="checkbox" name="itemid<?=$val['id']?>" value="<?=$val1?>" /><?=$val1?>
				<?php
						endforeach;
						break;
					default:
				?>
				--
				<?php
				endswitch;
				?>
			</div>
			<div class="n-col-3 n-nopadding n-padding-default-left">
				<?php
				if (in_array($val['itype'], array(0, 2))) :
					echo $val['unit'];
				endif;
				?>
			</div>
		</div>
		<?php
			endforeach;
		endif;
		?>
		<div class="n-col-3">
			<?php
			if (isset($data['id'])) :
			?>
			<input type="hidden" name="id" value="<?=$data['id']?>" />
			<?php
			else :
			?>
			<input type="hidden" name="scode" value="<?=$data['scode']?>" />
			<input type="hidden" name="templateid" value="<?=$data['templateid']?>" />
			<?php
			endif;
			?>
		</div>
		<div class="n-col-4 n-nopadding">
			<div class="a-form">
				<button type="submit" class="a-button-green">
					<i class="fa fa-2x fa-save" style="color:#fff;"></i>
				</button>
			</div>
		</div>
	</form>
	<div class="n-col-2 n-nopadding n-padding-default-left">
		<button class="a-button-default">
			<?php
			$args = array('scode' => $data['scode'], 'pevent' => $data['pevent']);
			$url = n_url('nconfig', 'siteIndex', $args);
			$text = '<i class="fa fa-2x fa-remove"></i>';
			echo n_ui($url, $text, 'style="display:block;"');
			?>
		</button>
	</div>
</div>
